package org.jsshbroadcast;

import java.beans.XMLDecoder;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 *
 * @author Eduardo Folly
 */
public class SysConfig {

    private static Config config = null;

    public static synchronized Config getInstance() {
        if (config == null) {
            config = new Config();
            try {
                XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(
                        new FileInputStream(config.getConfigLocal())));
                config = (Config) decoder.readObject();
                decoder.close();
            } catch (FileNotFoundException ex) {
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return config;
    }
}